<%include file="header.html"%> <%include file="top.html"%> <%include
file="left.html"%>
<div class="main-content">
<div class="breadcrumbs" id="breadcrumbs"><script
	type="text/javascript">
	try {
		ace.settings.check('breadcrumbs', 'fixed')
	} catch (e) {
	}
</script>

<ul class="breadcrumb">
	<li><i class="icon-home home-icon"></i> <a
		href="index.php">首页</a></li>
</ul>
<!-- .breadcrumb --></div>

<div class="page-content">
<div class="col-xs-12">
<div class="alert alert-info">
<form class="form-horizontal" role="form">
<div class="row">

<div class="col-sm-4">
<div class="row">
<label class="col-sm-3 control-label no-padding-right" for="form-field-5">游戏</label>
<div class="col-sm-3"><select id="selectGame">
	<option value="" >游戏</option>
	<%if $selectGames%> <%foreach from = $selectGames key = key item = value%>
	<%if $nowGame == $value %>
	<option value="<%$value%>" selected><%$value%></option>
	<%else%>
	<option value="<%$value%>"><%$value%></option>
	<%/if%> <%/foreach%> <%/if%>
</select>
</div>
</div>
</div>

<div class="col-sm-4">
<div class="row">
<label class="col-sm-3 control-label no-padding-right" for="form-field-5">平台</label>
<div class="col-sm-3">
<select id="selectPlatform">
	<option value="" id="">平台</option>
	<%if $platformList%> <%foreach from = $platformList key = key item = platform%>
	<%if $nowPlatform == $platform %>
	<option value="<%$platform%>" selected><%$platform%></option>
	<%else%>
	<option value="<%$platform%>"><%$platform%></option>
	<%/if%> <%/foreach%> <%/if%>
	
</select>
</div>
</div>
</div>


<div class="col-sm-4">
<center>
<button type="button" onClick="formSubmit();"
	class="width-25 btn btn-sm btn-primary">查询</button>
</center>
</div>

</div>
</form>
</div>
</div>
<div class="col-xs-12">
<div class="table-header">
服务器状态信息
</div>





<div id="view"  class="table-responsive">
<table id="sample-table-4"
	class="table table-striped table-bordered table-hover">
	<thead>
	
		<tr>
			<th>服</th>  
			<th>当前在线</th>
			<th>当日新增用户</th>
			<th>当日新增设备</th>
			<th>当日充值用户</th>
			<th>当日充值</th>
			
			<th>总用户数</th>
			<th>总设备数</th>
			<th>总充值额</th>
			
			<th> 当前会话</th>
			<th>峰值会话</th>
		<!--  	<th>总接收字节</th> -->
			
			<th>总接收协议</th>
		<!--  	<th>总发送字节</th>   -->
			<th>总发送协议</th>
			<th>当前接收速率</th>
			<th>峰值接收速率</th>
			<th>当前发送速率</th>
			<th>峰值发送速率</th>
			<th>待处理任务</th>
		</tr>
	<thead>
	<thead>
	<tbody>
		
		<%foreach from=$serverStatusDatas item=data%>
		<tr>
			<td><%$data.platform%></td>
			<td><%$data.onlineUser%></td>
			<td><%$data.newUser%></td>
			<td><%$data.newDevice%></td>
			<td><%$data.rechargeUser%></td>
			<td><%$data.recharge%></td>

			<td><%$data.totalUser%></td>
			<td><%$data.totalDevice%></td>
			<td><%$data.totalRecharge%></td>
			
			<td><%$data.curSession%></td>
			<td><%$data.peakSession%></td>
		<!-- 	<td><%$data.totalRecvBytes%></td>  -->
			<td><%$data.totalRecvProto%></td>
	 <!-- 	<td><%$data.totalSendBytes%></td>  -->
			<td><%$data.totalSendProto%></td>
			<td><%$data.curRecvRate%></td>
			<td><%$data.peakRecvRate%></td>
			<td><%$data.curSendRate%></td>
			<td><%$data.peakSendRate%></td>
			<td><%$data.unprocessTaskCount%></td>
		</tr>
		<%/foreach%>


	</tbody>
</table>
</div>


<!-- /.table-responsive --></div>
</div>
<!-- /.page-content --></div>
<!-- /.main-content -->
<script type="text/javascript">


	jQuery(function($) {
		$('.date-picker').datepicker({
			autoclose : true
		}).next().on(ace.click_event, function() {
			$(this).prev().focus();
		});

		var oTable1 = $('#sample-table-2').dataTable({
			"aoColumns" : [ {
				"bSortable" : false
			}, {
				"bSortable" : false
			}, {
				"bSortable" : false
			}, {
				"bSortable" : false
			}, {
				"bSortable" : false
			}, {
				"bSortable" : false
			}, {
				"bSortable" : false
			}
			]
		});
	});

	function formSubmit() {
		var game = $('#selectGame').val();
		var platform = $('#selectPlatform').val();
		
		if(!game) {
			alert("请选择游戏");
			return ;
		}
		url = "index.php?mod=Gm&do=serverStatus&action=1&game="
			+ game
			+ "&platform="
			+ platform;
		window.location.href = url;
	 }
	
	
	window.onload = function(){
		  var select = document.getElementById('selectGame');
		    select.onchange = function(){
		        // 更改值后执行的代码
		       var game = $('#selectGame').val();
		       $.ajax({
		    	    type: "POST",
					url: "index.php?mod=Game&do=getPlatformByGame&game=" + game,
					data: "",
					dataType: 'html',
					success: function(data) {					
						var dataObj = eval("(" + data + ")");//转换为json对象
						if(dataObj == null) {
							$("#selectPlatform").empty();
							$("#selectPlatform").append('<option value="" id="selectPlatform">平台</option>');
						}
						
						var platform = dataObj.platform;
						$("#selectPlatform").empty();
						$("#selectPlatform").append('<option value="" id="selectPlatform">平台</option>');
						for(var i=0;i<platform.length;i++){
							$("#selectPlatform").append("<option value='"+platform[i]+"' >"+platform[i]+"</option>"+"<br/>");
						}
					}
		       });
		    }
		
		
/* 	    var select = document.getElementById('selectGame');
	    select.onchange = function(){
	        // 更改值后执行的代码
	       var game = $('#selectGame').val();
			url = "index.php?mod=Gm&do=serverStatus&action=1&game="+game;
			window.location.href = url;  
	    } */
	} 
</script>
<%include file="footer.html"%>

